home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
os2
/
pvm34b3.zip
/
pvm34b3
/
pvm3
/
libfpvm
/
pvmftasks.m4
< prev
next >
Wrap
Text File
|
1997-07-22
|
1KB
|
63 lines
/* $Id: pvmftasks.m4,v 1.4 1997/05/07 18:07:32 pvmsrc Exp $ */
#include "pvm3.h"
#include "pvm_consts.h"
#include "../src/bfunc.h"
void
FUNCTION(pvmftasks)
ARGS(`where,
ntaskp,
tidp,
ptidp,
hostp,
flagp,
STRING_ARG(a_out),
infop')
int *where, *ntaskp, *tidp, *ptidp, *hostp, *flagp, *infop;
STRING_ARG_DECL(a_out);
{
static struct pvmtaskinfo *tip = 0;
static int ntask = 0;
static int next = 0;
int nt;
int cc;
/* if user sets ntaskp to -1 then pvmftasks() will be reset */
if ( ntask && ntaskp && (*ntaskp == -1) )
ntask = 0;
if ( !ntask ) {
if ( (cc = pvm_tasks( *where, &nt, &tip )) < 0 ) {
*infop = cc;
return;
}
ntask = nt;
next = 0;
}
if ( next < ntask ) {
if ( ntaskp ) *ntaskp = ntask;
if ( tidp ) *tidp = tip[ next ].ti_tid;
if ( ptidp ) *ptidp = tip[ next ].ti_ptid;
if ( hostp ) *hostp = tip[ next ].ti_host;
if ( flagp ) *flagp = tip[ next ].ti_flag;
if ( STRING_PTR(a_out) )
ctofstr( STRING_PTR(a_out), STRING_LEN(a_out),
tip[ next ].ti_a_out );
*infop = 1;
next++;
}
/* cannot return ti_pid without changing interface */
/* users needing this will have to use C */
if ( next == ntask )
ntask = 0;
}